package top.younote.cherry.listener;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import top.younote.cherry.email.DailyCalendarAndWeather;
import top.younote.cherry.selenium.BaiduService;
import top.younote.cherry.service.IMailService;

/**
 * @Description:
 * @Author: duanluyao
 * @CreateTime: 2021/9/28 19:38:05
 */
@Slf4j
@Component
public class ReceiveEventMessageListener {
    @Autowired
    private IMailService iMailService;
    @Autowired
    private BaiduService baiduService;
    @EventListener
    public void listenEvent(Object object) {
        System.out.println(object.toString());
    }
    @EventListener
    public void listenContextRefresh(ContextRefreshedEvent event) {
//        iMailService.sendLogs("项目启动完成！");
//        String content = DailyCalendarAndWeather.dailyNews(baiduService.getBaiduRealtime());
//        iMailService.sendHtmlMail("duanyu@martind.cn", "每日实时热搜", content);
        log.info("ContextRefreshedEvent 事件监听完成！");
    }
}
